#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

#include<string.h>
int reverse(char arr1[], char arr2[], int k)
{
	int i = 0;
	int len = strlen(arr1);
	k %= len;
	for (i = 0; i < k; i++)
	{
		char tmp = arr1[0];
		int j = 0;
		for (j = 0; j < len - 1; j++)
		{
			arr1[j] = arr1[j + 1];
		}
		arr1[len - 1] = tmp;
	}
	if (strcmp(arr1, arr2) == 0)
		return 1;
	else
		return 0;
}


int main()
{
	char arr1[] = "abcde";
	char arr2[] = "cdeab";
	int k = 0;
	scanf("%d", &k);
	int ret = reverse(arr1, arr2, k);
	printf("%d", ret);

	return 0;
}